package com.west.imclient.handler.impl;

import java.util.List;
import java.util.Map;

import javax.swing.JList;

import com.west.imclient.handler.IHandler;
import com.west.imclient.view.MeetingRoomView;

import imserverentity.entity.impl.Client;

public class SynHandler implements IHandler{
	private Map<String, Object> params;
	private MeetingRoomView meetingRoomView;
	
	public SynHandler(Map<String, Object> params, MeetingRoomView meetingRoomView) {
		this.params = params;
		this.meetingRoomView = meetingRoomView;
	}
	
	public void handle() {
		List<String> clients = (List<String>) params.get("list");
		System.out.println("clients: " + clients);
		clients.add(0, "All");
		clients.remove(((Client)meetingRoomView.getClient()).getAccount());
		String[] clientArray = new String[clients.size()];
		clients.toArray(clientArray);
		for(String c: clientArray) {
			System.out.println("Client: " + c);
		}
		JList cJList = meetingRoomView.getCjl();
		System.out.println(cJList);
		cJList.setListData(clientArray);
		
	}

}
